#include "Input.h"

Input::Input(){
	setQuit = false;
}

void Input::getInput(){
	while(SDL_PollEvent(&event)){
		switch(event.type){
			case SDL_QUIT:
				setQuit = true;

				break;
			case SDL_KEYDOWN:
				switch(event.key.keysym.sym){
					case SDLK_ESCAPE:
						setQuit = true;

						break;
					default:
						break;
				}
				break;
			case SDL_KEYUP:
				switch(event.key.keysym.sym){
					case SDLK_ESCAPE:
						setQuit = true;

						break;
					default:
						break;
				}
				break;
			default:
				break;
		}
	}
}

bool Input::keyDown(const char* key){
	itr = keys.find(key);

	if(itr != keys.end())
		return itr->second;
	else
		return false;
}

bool Input::keyUp(const char* key){
	itr = keys.find(key);

	if(itr != keys.end())
		return !itr->second;
	else
		return true;
	
}

Input::~Input(){

}